package com.dongdongsongcan.app.activity;

import android.content.Context;
import android.os.Bundle;
import android.view.Window;

import com.dongdongsongcan.app.DDApp;
import com.dongdongsongcan.app.utils.LocationUtil;
import com.su.dolphin.core.AppThread;
import com.dongdongsongcan.app.R;
import com.dongdongsongcan.app.test.DpTestCase;
import com.su.dolphin.utils.LogUtil;
import com.su.dolphin.utils.mgr.DpActivityManager;
import com.su.dolphin.view.activity.BaseActivity;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class StartActivity extends BaseActivity {

    public static void startFrom(Context context) {
        DpActivityManager.i().startActivity(context, StartActivity.class);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setTitlebarEnable(false);
        setContentView(R.layout.activity_start);
        DpTestCase.runTest();
        //if (DDApp.getDDLocation() == null) {
        LocationUtil.getLocation(this);
        // }
        AppThread.uiPost(new Runnable() {

            @Override
            public void run() {
                MainActivity.startFrom(StartActivity.this);
                finish();
            }
        });

    }

    @Override
    public void initView() {
    }

    @Override
    public void setListener() {

    }

    @Override
    public void initData() {
        String msg = " 【咚咚送餐】 登陆验证码7722，请勿泄露";
        String verifyCode = null;
        Pattern p = Pattern.compile("\\d{4}");
        Matcher m = p.matcher(msg);
        while (m.find()) {
            verifyCode = m.group();
            break;
        }
        LogUtil.d("verifyCode " + verifyCode);

    }

}
